package com.sinszm.web.soap.interceptor;

import com.sinszm.common.util.CommonUtils;
import com.sinszm.web.soap.SzmLocalTime;
import lombok.extern.slf4j.Slf4j;
import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.phase.Phase;

/**
 * 标题：访问结束日志
 * 描述：
 * 类名：SzmOutInterceptor
 * 时间：2020-6-20 14:17
 *
 * @author chenjianbo
 */
@Slf4j
public class SzmOutInterceptor extends AbstractSoapInterceptor {

    public SzmOutInterceptor() {
        super(Phase.SEND_ENDING);
    }

    @Override
    public void handleMessage(SoapMessage message) throws Fault {
        long ms = System.currentTimeMillis() - SzmLocalTime.getInstance().get();
        String threadNumber = CommonUtils.getProcessId() + "/" + CommonUtils.getThreadId();
        log.info(">>[{}]>>[耗时：{} ms]>> WebService End >>",threadNumber, ms);
    }

}
